package graphics.server;

import java.applet.Applet;
import java.awt.GridLayout;
import java.util.HashMap;

import javax.swing.JLabel;
import javax.swing.JPanel;

public class ScoreBoom extends Applet{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private HashMap<String, JLabel> _agents;
	private JPanel p;
	
	
	/**
	 * Create a board and initialize it.
	 */
	public void init(String[] agents)
	{
		_agents = new HashMap<String, JLabel>();
		p = new JPanel();
		p.setLayout(new GridLayout(agents.length,3));
		
		for (int i=0; i<agents.length; i++){
			_agents.put(agents[i], new JLabel("0"));
			p.add(new JLabel(agents[i]));
			p.add(new JLabel("            "));
			p.add(_agents.get(agents[i]));
		}
		
		add(p);
	}
	
	public void updateScore(String name, int newScore) {
		JLabel tmp = _agents.get(name);
		tmp.setText(newScore+"");
	}

	
}
